package online.test1;

import java.util.Scanner;

/**
 * @Author 28021
 * @Date 2022/10/10
 */
public class UserLogin {
    public static void main(String[] args) {
        String userName = "sy";
        String userPasswd = "123";
        Scanner in = new Scanner(System.in);

        System.out.println("请输入用户名：");
        String n1 = in.next();
        if (userName.equals(n1)){
            System.out.println("请输入"+userName+"的密码：");
            String p1 = in.next();

            if (userPasswd.equals(p1) != true) {
                for (int i = 1; i < 3; i++) {
                    System.out.println("请再次输入" + userName + "的密码：");
                    p1 = in.next();
                }
                System.out.println("密码错误次数过多，登陆失败");
            }else{
                System.out.println("登陆成功");
            }
        }else{
            System.out.println("该用户不存在");
        }
    }
}

